<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<jsp:include page="../frame/header.jsp"></jsp:include>

<title>"约"管理</title>
<style>
.checkbox{
	padding-left: 0px;
}
div.in-line{
	margin-top:5px;
}
div.in-line label{
	width:70px;
	text-align:right;
}
#searchBtn{
	text-align:right;
}
.form-horizontal .form-actions {
padding-left: 0px;
}
#addBtn{
	margin-left:5px;
}
</style>
</head>

<body>

	<div class="container-fluid">
		<div id="market" class="row-fluid">
			<div>
				<ul class="breadcrumb">
					<li><a href="#">娱乐交友</a> <span class="divider">/</span></li>
					<li><a href="#">主题管理</a></li>
				</ul>
			</div>

			<div class="box">
				<div class="box-header well" data-original-title>
					<h2>
						<i class="icon-th"></i> “约”管理
					</h2>

					<div class="box-icon">
						<a href="#" class="btn btn-setting btn-round"><i
							class="icon-cog"></i></a> <a href="#"
							class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						<a href="#" class="btn btn-close btn-round"><i
							class="icon-remove"></i></a>
					</div>
				</div>
				<div class="box-content">
					<div id="search-form">
					<form id="searchForm" method="post" class="form-search span12" action="<c:url value="/admin/forum/appoint/search"/>">
						<input type="hidden" name="forumId" value="0">
						<div class="in-line">
						<input type="hidden" name="pageNum" id="pageNum" value="${searchForm.pageNum }">
						<label>标题：</label>
						<input type="text" name="title" id="title" value="${searchForm.title }" 
								class="input-large search-query">
						</div>
						<div class="in-line">
						<label>发表时间：</label>
						<input class="input-large datepicker"  name="startTime" id="date1" 
										type="text" value="" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;至：
						<input class="input-large datepicker" name="endTime" id="date2" 
										type="text" value="" >
						</div>
						<div class="in-line">
						<label>作者：</label>
						<input type="text" name="authors" id="authors" value="${searchForm.authors }" 
								class="input-large search-query">
						<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(多用户名中间请用半角逗号 "," 隔开）</span>
						<button type="button" id="addBtn" class="btn btn-primary pull-right">&nbsp;&nbsp;发布约&nbsp;&nbsp;</button>
						<button type="button" id="searchBtn" class="btn btn-success pull-right">&nbsp;&nbsp;搜索&nbsp;&nbsp;</button>&nbsp;&nbsp;
						</div>
						
					</form>
					</div>
					<table id="userInfo" class="table table-striped table-bordered ">
						<thead>
							<tr>
								<th>标题</th>
								<th>约类型</th>
								<th>约人数</th>
								<th>约时间</th>
								<th>约要求</th>
								<th>发布时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="topic" items="${pageModel.result }" varStatus="status">
								<tr>
									<td>${topic.subject }</td>
									<td>${topic.menuName }</td>
									<td>${topic.members }人 </td>
									<td>${topic.appointTime }</td>
									<td>${topic.appointDemand }</td>
									<td>${topic.lastPostDate }</td>
									<td>
										<a href="<c:url value="/admin/forum/appoint/${topic.topicId }"/>">编辑</a>
										<a href="javascript:void(0);" onclick="delTopic('${topic.topicId }')">删除</a>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div id="mypager" class="mypager"></div>
					<div>
						<hr>
					</div>
					
					
				</div>
			</div>
		</div>
		<!--/fluid-row-->

	</div>
	<!--/.fluid-container-->

	<jsp:include page="../frame/scripts.jsp"></jsp:include>
	<script type="text/javascript">
	var pageNum = "${pageModel.pageNum}";
	var totalPage = "${pageModel.totalPage}";
	var numPerPage = "${pageModel.numPerPage}";
	
	$(document).ready(function(){
				
		$('.datepicker').datepicker('option', 'dateFormat', 'yy-mm-dd'); 
		
		$( "#date1" ).datepicker( "setDate", "${searchForm.startTime}" );
		$( "#date2" ).datepicker( "setDate", "${searchForm.endTime}" );
		
		$('#mypager').bootstrapPaginator({
			currentPage:pageNum,
			totalPages:totalPage,
			numberOfPages:numPerPage,
			onPageClicked:function(event, originalEvent, type,page){
				$("input[name='pageNum']").val(page);
				$("#searchForm").submit();
			}
		});
		
		$('#searchBtn').click(function(){
			$("#searchForm").submit();
		})
		
		$('#addBtn').click(function(){
			window.location.href = "<c:url value="/admin/forum/addAppoint" />";
		});
		
	})
	
	function delTopic(id){
		if(confirm("确定要删除吗？")){
			$("input[name='forumId']").val(id);
			$("#searchForm").submit();
		}
	}
	</script>
	
</body>
</html>
